<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button>点名</button>
    <h1></h1>
    <script src="./jquery-3.6.0.js"></script>
    <script>
        let arr = ["zs", "ls", "ww", "xh", "xm"]
        $('button').one('click', function () {
            let i = 0
            //计时器开始
            let s = setInterval(function () {
                i++
                //随机下标
                let index = Math.floor(Math.random() * arr.length)
                $('h1').text(arr[index])
                if (i == 5) {
                    //清除计时器
                    clearInterval(s)
                }
            }, 500);
        })
    </script>
</body>

</html>